#define _CRT_SECURE_NO_WARNINGS 2

#include"BTNode.h"

 void AddBTNode(pBTNode* node, datatype x) {
	*node = (pBTNode)malloc(sizeof(BTNode));
	if (*node == NULL) {
		perror("node  fail malloc");
		return ;
	}
	(*node)->val = x;
	(*node)->left = NULL;
	(*node)->right = NULL;
}

void PreOrder(pBTNode root) {
	if (!root) {
		printf("NULL ");
		return;
	}
	printf("%d ", root->val);
	PreOrder(root->left);
	PreOrder(root->right);
}

void InOrder(pBTNode root) {
	if (!root) {
		printf("NULL ");
		return;
	}
	InOrder(root->left);
	printf("%d ", root->val);
	InOrder(root->right);
}


void PastOrder(pBTNode root) {
	if (!root) {
		printf("NULL ");
		return;
	}
	PastOrder(root->left);
	PastOrder(root->right);
	printf("%d ", root->val);

}